package bishi.alibaba;

/**
 * @Info:
 * @Author: 唐小尊
 * @Date: 2020/3/25  14:52
 */
public class _37 {
    public static void main(String[] args) {
        System.out.println(solution(5, new int[]{2,2,2,2,3}));;

    }

    public static int solution(int n,int[] a) {
        int max = 0;
        int num = 0;
        int maxNum = 0;
        for(int i=0;i<n;i++){
            if(a[i]<max){
                continue;
            }else if(a[i]>max){
                int now = a[i];
                num = 1;
                while(i+1<n&&a[i+1]==now){
                    num++;
                    i++;
                }
                if (now>max){
                    maxNum = num;
                    max = a[i];
                }else{
                    maxNum = Math.max(num,maxNum);
                }
            }
        }
        return maxNum;
    }
}
